<?php
namespace app\index\model;


use Exception;
use RuntimeException;
use think\Model;

class WaybillHistory extends Model
{
    public static function getHistoryListById($id)
    {
        $waybillHistoryClass=new self();
        $list=$waybillHistoryClass->alias('w')
            ->join('logistics l','w.logistics_id=l.id','left')
            ->join('waybill wb','w.waybill_id=wb.id','left')
            ->join('user u','w.create_user=u.id','left')
            ->where('w.waybill_id',$id)
            ->field('w.*,l.company,u.user_name,wb.ship_no')
            ->order('w.create_time desc')
            ->select()->toArray();
        foreach ($list as $k=>$v){
            if ($v['action']==0){
                $list[$k]['action_name']='编辑';
            }else{
                $list[$k]['action_name']='发货';
            }
        }
        return $list;
    }
}